package com.tian.zmp.controller;

import com.alibaba.fastjson.JSONObject;
import com.tian.zmp.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Author zhump
 * Description
 * Date 2018/1/28 9:36
 * Version 1.0.1
 */
@Controller
public class TestController {

    @Autowired
    private RedisService redisService;

    @RequestMapping(value = "one1",method = RequestMethod.GET)
    @ResponseBody
    public JSONObject one1(){
        String key = "one1";
        String value = "ceshi-one";
        String set = redisService.set(key, value);
        System.out.println(set);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code","1");
        jsonObject.put("message","执行成功");
        jsonObject.put("data",set);
        return jsonObject;
    }
}
